<?php

namespace App\Module\Api\Controllers;
use App\Module\Api\Controllers\Request\OrderListWhereRequest;
use App\Module\Api\Validator\OrderListValidator;
use App\System\Base\Services\UserTokenService;
use App\System\Goods\Repositories\GoodsInfoRepository;
use App\System\Order\Repositories\OrderInfoRepository;

/**
 * 订单列表
 */
class OrderListController extends Controller
{
    public function __construct()
    {
        $this->where = new OrderListWhereRequest();
        parent::__construct();


    }

    public function index()
    {

        $user_id = UserTokenService::getUserId();
        (new OrderListValidator())->check();
        $order = OrderInfoRepository::getInstance();
        $data = $order->getApiList($this->table,$this->where,$user_id);
        return apiResponse($data);

    }

    public function setOrderBy()
    {
       return [1=>'updated_at',2=>'id'];
    }
}
